<template>
  <el-dialog :title="title"  center :visible.sync="open" v-if="open" width="1024px" append-to-body :close-on-click-modal="false">
    <el-form ref="detailForm" :model="detailForm" :rules="rules" label-width="140px">
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>基本信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="交易流水号" prop="id">
              <el-input v-model="detailForm.id" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="CPG日期" prop="vdate">
              <el-date-picker
                v-model="detailForm.vdate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="工作日期" prop="workdate">
              <el-date-picker
                v-model="detailForm.workdate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务类型" prop="bizTypeCode">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.bizTypeCode === null || detailForm.bizTypeCode === undefined
                    ? ''
                    : detailForm.bizTypeCode + '-' + detailForm.bizTypeCodeDesc
                "
                placeholder="业务类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="业务种类" prop="bizCtgyCode">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.bizCtgyCode === null || detailForm.bizCtgyCode === undefined
                    ? ''
                    : detailForm.bizCtgyCode + '-' + detailForm.bizCtgyCodeDesc
                "
                placeholder="业务种类"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务回执期限" prop="bizRtDate">
              <el-date-picker
                v-model="detailForm.bizRtDate"
                style="width: 100%"
                type="date"
                value-format="yyyyMMdd"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="扣款合同编号" prop="chargeNumber">
              <el-input v-model="detailForm.chargeNumber" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>收款人信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="收款人账号" prop="payeeActno">
              <el-input v-model="detailForm.payeeActno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款人名称" prop="payeeName">
              <el-input v-model="detailForm.payeeName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="收款行行号" prop="payeeBrno">
              <el-input v-model="detailForm.payeeBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款行行名" prop="payeeBrname">
              <el-input v-model="detailForm.payeeBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="收款人开户行行号" prop="payeeAccBrno">
              <el-input v-model="detailForm.payeeAccBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="收款人开户行行名" prop="payeeAccBrname">
              <el-input v-model="detailForm.payeeAccBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>付款人信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="付款人账号" prop="payerActno">
              <el-input v-model="detailForm.payerActno" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款人名称" prop="payerName">
              <el-input v-model="detailForm.payerName" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="付款行行号" prop="payerBrno">
              <el-input v-model="detailForm.payerBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="付款行行名" prop="payerBrname">
              <el-input v-model="detailForm.payerBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="付款人开户行行号" prop="payerAccBrno">
              <el-input v-model="detailForm.payerAccBrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="付款人开户行名称" prop="payerAccBrname">
              <el-input v-model="detailForm.payerAccBrname" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
      <el-card class="form-card payerInfo-card">
        <div slot="header" class="label-header-msg">
          <span>其他交易信息</span>
        </div>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="货币种类" prop="curcd">
              <el-input v-model="detailForm.curcd" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="金额" prop="amount">
              <ht-amount-input v-model="detailForm.amount" placeholder="金额" :disable="true"></ht-amount-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="附言" prop="content">
              <el-input type="textarea" v-model="detailForm.content" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="记账标志" prop="cbflag">
              <el-select style="width: 100%" v-model="detailForm.cbflag" placeholder="记账标志" :disabled="true">
                <el-option
                  v-for="dict in dictMap.CBFLAG"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="业务回执状态" prop="bizRtStatus">
              <el-select
                style="width: 100%"
                v-model="detailForm.bizRtStatus"
                placeholder="业务回执状态"
                :disabled="true"
              >
                <el-option
                  v-for="dict in dictMap.PROCESSSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="业务拒绝处理码" prop="rejectCode">
              <el-select
                style="width: 100%"
                v-model="
                  detailForm.rejectCode === null || detailForm.rejectCode === undefined
                    ? ''
                    : detailForm.rejectCode + '-' + detailForm.rejectCodeDesc
                "
                placeholder="原业务类型"
                :disabled="true"
              ></el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="业务拒绝原因" prop="rejectContent">
              <el-input type="textarea" v-model="detailForm.rejectContent" :disabled="true" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="录入操作员" prop="mdTlrno">
              <el-input v-model="detailForm.mdTlrno" :disabled="true" />
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="录入时间" prop="mdTime">
              <el-date-picker
                style="width: 100%"
                v-model="detailForm.mdTime"
                value-format="yyyyMMddHHmmss"
                type="datetime"
                :disabled="true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="24">
            <el-form-item label="审核附言" prop="audRemarks">
              <el-input type="textarea" v-model="detailForm.audRemarks" maxlength="128" show-word-limit />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>
    </el-form>
    <div slot="footer" class="dialog-footer" align="center">
      <el-button type="primary" @click="approve" v-loading.fullscreen.lock="loading">审 核</el-button>
      <el-button type="primary" @click="reject" v-loading.fullscreen.lock="loading">拒 绝</el-button>
      <el-button type="primary" @click="cancel">关 闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import BaseDataDialog from "@/views/components/BasedataDialog";
import HtAmountInput from "@/views/components/HtAmountInput";
import {
  bepsDebitNostroHdWk127B104Query,
  bepsDebitNostroHdWk127B307Query,
  bepsDebitNostroHdWk127EndorserTbQuery,
  bepsDebitNostroHdWkSave127,
} from "@/api/cnaps/beps/baseHandWork/bepsDebitNostroHdWk";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";
import { getBasedata } from "@/api/cnaps/common/basedata";
import {
  bepsDebitReceiptAuditApproveApprove5013,
  bepsDebitReceiptAuditApproveReject5013,
} from "@/api/cnaps/beps/baseHandWork/bepsDebitReceiptAuditApprove";
export default {
  name: "BepsDebitReceiptAuditApproveDetail5013",
  components: { HtAmountInput, BaseDataDialog },
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    detailForm: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      loading: false,
      title: "小额借记来账手工处理审核明细",
      rules: {},
    };
  },
  mounted() {},
  methods: {
    show() {
      this.open = true;
    },

    cancel() {
      this.open = false;
    },

    approve: function () {
      this.$refs["detailForm"].validate((valid) => {
        if (valid) {
          this.loading = true;
          bepsDebitReceiptAuditApproveApprove5013(this.detailForm)
            .then((response) => {
              this.msgSuccess("审核成功");
              this.open = false;
              this.$nextTick(() => {
                this.$parent.$refs.dataTable.doQuery(true);
              });
              this.loading = false;
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },

    reject: function () {
      this.$refs["detailForm"].validate((valid) => {
        if (valid) {
          this.loading = true;
          bepsDebitReceiptAuditApproveReject5013(this.detailForm)
            .then((response) => {
              this.msgSuccess("拒绝成功");
              this.open = false;
              this.$nextTick(() => {
                this.$parent.$refs.dataTable.doQuery(true);
              });
              this.loading = false;
            })
            .catch((err) => {
              this.loading = false;
            });
        }
      });
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
